﻿using Microsoft.EntityFrameworkCore;

namespace Day.Data;

public class DayContext : DbContext
{
    private string DbPath { get; }
    public DbSet<DayModel> Days { get; set; }

    public DayContext()
    {
        var folder = Environment.SpecialFolder.LocalApplicationData;
        var path = Environment.GetFolderPath(folder);
        DbPath = Path.Join(path, "day.db");
    }

    // The following configures EF to create a Sqlite database file in the
    // special "local" folder for your platform.
    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlite($"Data Source={DbPath}");
}